home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Psetlimit(2) Oct. 1, 1991 Psetlimit(2)
-
-
- N✓NA✓AM✓ME✓E
- Psetlimit - get or set limits on use of system resources
-
- S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
- LONG Psetlimit( WORD lim, LONG value );
-
- D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
- _✓P_✓s_✓e_✓t_✓l_✓i_✓m_✓i_✓t gets or sets a resource limit for a process.
- Which limit is affected is governed by the value of _✓l_✓i_✓m,
- as follows:
- 1: get/set maximum CPU time for process (in milliseconds)
- 2: get/set total maximum memory allowed for process
- 3: get/set limit on Malloc'd memory for process
-
- If _✓v_✓a_✓l_✓u_✓e is negative, the limit is unchanged; if _✓v_✓a_✓l_✓u_✓e is
- 0, the corresponding resource is unlimited; otherwise, the
- resource limit is set to _✓v_✓a_✓l_✓u_✓e.
-
-
- Setting the "maximum memory" limit means the process is
- not allowed to grow bigger than that size overall. Setting
- the "maximum Malloc'ed" limit means that the process may
- allocate no more than that much memory. The difference is
- that the latter limit applies above and beyond the
- text+data+bss size of the process.
-
-
- Using Psetlimit sets the corresponding limit for both the
- process and any children it creates thereafter. Note that
- the limits apply to each process individually; setting the
- child CPU limit value to 1000 and then using _✓f_✓o_✓r_✓k(2) to
- create three children results in each of those children
- getting a CPU limit value of one second. They do not have
- a _✓c_✓o_✓l_✓l_✓e_✓c_✓t_✓i_✓v_✓e or _✓s_✓u_✓m _✓t_✓o_✓t_✓a_✓l limit of one second.
-
-
- There is no restriction on _✓i_✓n_✓c_✓r_✓e_✓a_✓s_✓i_✓n_✓g a limit. Any process
- may set any of its limits or its childrens' limits to a
- value greater than its current limit, or even to zero
- (unlimited).
-
-
- Memory limits do not apply during execution of Pexec; that
- is, if a process is limited to (say) 256KB of memory, it
- can still exec a child which uses more memory.
-
-
- Memory limits are not retroactive: if a process owns 256KB
- of memory and then calls Psetlimit to restrict itself to
- 128KB, it will not be terminated, but no Malloc calls will
- succeed until its size drops below 128KB.
-
-
- CPU limits are retroactive, however: if a process has used
-
-
-
- Version 0.9 MiNT Programmer's Manual 1
-
-
-
-
-
- Psetlimit(2) Oct. 1, 1991 Psetlimit(2)
-
-
- three CPU seconds and calls Psetlimit to restrict itself
- to one second, it will immediately receive SIGXCPU and
- terminate.
-
-
- R✓RE✓ET✓TU✓UR✓RN✓NS✓S
- The old limit (0 if there was no limit).
-
-
- B✓BU✓UG✓GS✓S
- Since the limit applies to the process and its children,
- you can't limit a child to, say, one millisecond of CPU
- time: the parent must necessarily limit itself before cre-
- ating the child, and if it has used more than a millisec-
- ond itself, it will die with SIGXCPU. A new set of _✓l_✓i_✓m
- arguments is needed that apply to the caller's future
- children without applying to the caller.
-
-
- To alleviate this, the parent must create a child process
- via Pvfork, and _✓t_✓h_✓i_✓s process (which hasn't consumed any
- CPU time yet) must call Psetlimit and then Pexec to create
- the child that is meant to be limited.
-
-
- S✓SE✓EE✓E A✓AL✓LS✓SO✓O
- _✓P_✓r_✓u_✓s_✓a_✓g_✓e(2)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Version 0.9 MiNT Programmer's Manual 2
-
-
-